package gases.as3.librarys.compnents.ui.control
{
	import gases.as3.librarys.compnents.skin.data.BaseSkin;
	import gases.as3.librarys.compnents.ui.basic.GLabel;

	public class GLabelButton extends GButton
	{
		public function GLabelButton(label:String=null, labelColor:uint=0xFFFFFF)
		{
			if(label != null)
			{
				_txt = label;
			}
			_color = labelColor;
			super();
		}
		
		override protected function initialization():void
		{
			super.initialization();
			_label = new GLabel(_txt, _color);
			this.addChild(_label);
		}
		
		override public function set skin(value:BaseSkin):void
		{
			super.skin = value;
			_label.x = (background.Gwidth - _label.Gwidth) * 0.5;
			_label.y = (background.Gheight - _label.Gheight) * 0.5;
		}
		
		public function set color(value:uint):void
		{
			_color = value;
			_label.color = _color;
		}
		
		public function set text(value:String):void
		{
			_label.text = value;
		}
		
		override public function dispose():void
		{
			this.removeChild(_label);
			_label.dispose();
			_label = null;
			super.dispose();
		}
		
		private var _color:uint;
		private var _label:GLabel;
		private var _txt:String ="";

	}
}


